#include <iostream>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <unistd.h>
#include <stdio.h>

using namespace std;

int main()
{
    key_t key=ftok("pan",315);
    int shmid=shmget(key,4096,IPC_CREAT|IPC_EXCL|0666);

    char* shmaddr=(char*)shmat(shmid,nullptr,0);

    // shmaddr="i am process A";

    cout<<"Enter:";
    fgets(shmaddr,4096,stdin);

    sleep(10);

    shmdt(shmaddr);
    shmctl(shmid,IPC_RMID,nullptr);
    
    return 0;
}